package saxon.gui.view.swing;

import java.awt.Component;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JPanel;

/**
 *
 * @author lennyn
 */
public class VPanel extends JPanel {

	public VPanel(Component... components) {
		this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		for (Component comp : components) {
			this.add(comp);
		}
	}

	@Override
	public final Component add(Component comp) {
		return super.add(comp);
	}

	public static Component glue() {
		return Box.createVerticalGlue();
	}

	public static Component space(int width) {
		return Box.createVerticalStrut(width);
	}

	@Override
	public void setEnabled(boolean enabled) {
		for (Component comp : this.getComponents()) {
			comp.setEnabled(enabled);
		}
	}
}
